home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 272_01 / argval.doc < prev    next >
Text File  |  1986-09-23  |  1KB  |  39 lines

  1.  
  2.  
  3.         NAME
  4.                 argval -- convert an ASCII numerical string from an argument
  5.  
  6.         SYNOPSIS
  7.                 i = argval(string, dest, i);
  8.                 int i;         index into the current argument string
  9.                                which is returned incremented to the
  10.                                first character after the numerical string
  11.                 char *string;  the string containing the numerical value
  12.                 int dest;      destination for resultant integer value
  13.  
  14.  
  15.         DESCRIPTION
  16.         This function is primarily intended to parse command line arguments
  17.         containing numerical values into an integer.  The function will
  18.         abort the program if the index points to a non-numeric digit
  19.         upon entry with an error message and the option character which
  20.         preceeds the index pointer.
  21.         Numeric values cannot exceed four characters without causing
  22.         potential damage to the program by overrunning the character
  23.         storage area.
  24.  
  25.         EXAMPLE
  26.                 assume argv[1] = "-M30C"
  27.  
  28.                 int i, value;
  29.                 i = 2    /* i is incremented to '3' by other code */
  30.                 i = argval(&argv[1], value, i);
  31.  
  32.                 after execution, i = 4 (pointing to 'C')
  33.                                  value = 30
  34.                                  argv[1] is unchanged
  35.  
  36.  
  37.  
  38.        This function is found in SMDLx.LIB for the Datalight Compiler.
  39.